Skip to content

Update terminal output and add limiting factor to adaptive output - #1757

Draft
wilfonba wants to merge 9 commits into
MFlowCode:masterfrom
wilfonba:TerminalOutput
Draft

Update terminal output and add limiting factor to adaptive output#1757
wilfonba wants to merge 9 commits into
MFlowCode:masterfrom
wilfonba:TerminalOutput

Conversation

@wilfonba

@wilfonba wilfonba commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

This PR improves the runtime terminal output for simulations. The terminal output width is reduced. The following shows a before and after for a constant delta t simulation

Before:
 [  0%]  Time step        1 of 1001 @ t_step =        0 Time Avg = 0.000000E+00 Time/step= 0.000000E+00 ETA (HH:MM:SS) = 0:00:00
 [  1%]  Time step        2 of 1001 @ t_step =        1 Time Avg = 0.000000E+00 Time/step= 3.007400E-02 ETA (HH:MM:SS) = 0:00:00
 [  1%]  Time step        3 of 1001 @ t_step =        2 Time Avg = 0.000000E+00 Time/step= 2.920300E-02 ETA (HH:MM:SS) = 0:00:00
 [  1%]  Time step        4 of 1001 @ t_step =        3 Time Avg = 2.900600E-02 Time/step= 2.900600E-02 ETA (HH:MM:SS) = 0:00:28
 [  1%]  Time step        5 of 1001 @ t_step =        4 Time Avg = 2.869950E-02 Time/step= 2.839300E-02 ETA (HH:MM:SS) = 0:00:28
 [  1%]  Time step        6 of 1001 @ t_step =        5 Time Avg = 2.865167E-02 Time/step= 2.855600E-02 ETA (HH:MM:SS) = 0:00:28

After:
 [  0%] step 1 of 1001 (t_step 0) t/step  0.00E+00s (avg  0.00E+00s) ETA 0:00:00
 [  1%] step 2 of 1001 (t_step 1) t/step  2.88E-02s (avg  0.00E+00s) ETA 0:00:00
 [  1%] step 3 of 1001 (t_step 2) t/step  2.83E-02s (avg  0.00E+00s) ETA 0:00:00
 [  1%] step 4 of 1001 (t_step 3) t/step  2.75E-02s (avg  2.75E-02s) ETA 0:00:27
 [  1%] step 5 of 1001 (t_step 4) t/step  2.76E-02s (avg  2.76E-02s) ETA 0:00:27
 [  1%] step 6 of 1001 (t_step 5) t/step  2.80E-02s (avg  2.77E-02s) ETA 0:00:27

The output for a cfl_const_dt is identical since the delta t is constant. The following shows the before and after for a cfl_adap_dt simulation

Before:
 [  0%] Time     0.000000E+00 dt =     1.940738E-06 @ Time Step =        0 Time Avg =     0.000000E+00 Time/step = 0.000000E+00 ETA (HH:MM:SS) = 0:00:00
 [  1%] Time     1.940738E-06 dt =     1.940196E-06 @ Time Step =        1 Time Avg =     6.183838E-04 Time/step = 6.122000E-02 ETA (HH:MM:SS) = 0:00:02
 [  1%] Time     3.880934E-06 dt =     1.940727E-06 @ Time Step =        2 Time Avg =     1.212500E-03 Time/step = 6.003000E-02 ETA (HH:MM:SS) = 0:00:04
 [  1%] Time     5.821661E-06 dt =     1.940699E-06 @ Time Step =        3 Time Avg =     1.784436E-03 Time/step = 5.897800E-02 ETA (HH:MM:SS) = 0:00:07
 [  1%] Time     7.762360E-06 dt =     1.940079E-06 @ Time Step =        4 Time Avg =     2.336284E-03 Time/step = 5.807300E-02 ETA (HH:MM:SS) = 0:00:09
 [  1%] Time     9.702439E-06 dt =     1.939277E-06 @ Time Step =        5 Time Avg =     2.875777E-03 Time/step = 5.790400E-02 ETA (HH:MM:SS) = 0:00:11
 [  1%] Time     1.164172E-05 dt =     1.939666E-06 @ Time Step =        6 Time Avg =     3.401279E-03 Time/step = 5.752800E-02 ETA (HH:MM:SS) = 0:00:14
After:
 [  0%] t =  0.0000E+00 dt =  1.9407E-06 (ICFL) @ step 0 t/step  0.00E+00s (avg  0.00E+00s) ETA 0:00:00
 [  1%] t =  1.9407E-06 dt =  1.9402E-06 (ICFL) @ step 1 t/step  6.09E-02s (avg  6.15E-04s) ETA 0:00:02
 [  1%] t =  3.8809E-06 dt =  1.9407E-06 (ICFL) @ step 2 t/step  5.87E-02s (avg  1.20E-03s) ETA 0:00:04
 [  1%] t =  5.8217E-06 dt =  1.9407E-06 (ICFL) @ step 3 t/step  5.83E-02s (avg  1.76E-03s) ETA 0:00:07
 [  1%] t =  7.7624E-06 dt =  1.9401E-06 (ICFL) @ step 4 t/step  5.71E-02s (avg  2.30E-03s) ETA 0:00:09
 [  1%] t =  9.7024E-06 dt =  1.9393E-06 (ICFL) @ step 5 t/step  5.73E-02s (avg  2.84E-03s) ETA 0:00:11

Contribution Policy

We do not accept pull requests generated primarily by AI without genuine understanding or real-world usage context.

All contributions are expected to demonstrate:

  • A clear understanding of the codebase
  • Alignment with product direction
  • Thoughtful reasoning behind changes
  • Evidence of real-world usage or hands-on experience with the problem

If these expectations are not met, we would prefer to implement the changes ourselves rather than spend time reviewing low-effort submissions.


Acknowledgement

  • I confirm this PR meets the above expectations and reflects my own understanding and real-world context.

PR template credit: junegunn

Copilot AI lite review requested due to automatic review settings August 24, 2026 15:18
@wilfonba
wilfonba requested a review from sbryngelson as a code owner August 24, 2026 15:18
Comment thread src/simulation/m_time_steppers.fpp Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

This PR refines simulation runtime terminal output formatting and adds visibility into which CFL criterion (inviscid/viscous/capillary) is limiting the adaptive time step.

Changes:

  • Track per-criterion CFL candidate time steps and select the global limiting criterion.
  • Add an MPI helper to allreduce elementwise minima for small real vectors.
  • Update printed progress lines to be shorter and (for adaptive CFL) include the limiting criterion tag.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/simulation/m_time_steppers.fpp Computes per-criterion dt candidates, reduces globally, and records which criterion limits dt.
src/simulation/m_start_up.fpp Updates progress/ETA print formatting and appends limiter tag for adaptive dt runs.
src/simulation/m_sim_helpers.fpp Exposes dt_limiter state and expands CFL helper to return 3 candidate dts.
src/common/m_mpi_common.fpp Adds s_mpi_allreduce_min_vec for elementwise global minima of real vectors.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/common/m_mpi_common.fpp
Comment thread src/simulation/m_sim_helpers.fpp Outdated
Comment thread src/simulation/m_sim_helpers.fpp Outdated
Comment thread src/simulation/m_time_steppers.fpp Outdated
@wilfonba
wilfonba marked this pull request as draft August 24, 2026 17:18
@github-actions

Copy link
Copy Markdown

Lines of Code

File Lines Diff
src/simulation/m_time_steppers.fpp 852 +24
src/common/m_mpi_common.fpp 1484 +10
src/simulation/m_collisions.fpp 337 +9
src/simulation/m_start_up.fpp 1253 +9
src/simulation/m_sim_helpers.fpp 200 +4
src/simulation/m_global_parameters.fpp 749 +2
Directory Lines Diff
common 9788 +10
simulation 28066 +48
total 45687 +58

@wilfonba
wilfonba marked this pull request as ready for review August 27, 2026 11:24
@wilfonba

Copy link
Copy Markdown
Contributor Author

@sbryngelson I believe a benchmark run will cover any performance regressions from this change. I can't approve my own PR, so you'll need to approve it to trigger the benchmarking.

@sbryngelson

Copy link
Copy Markdown
Member

drafting until pr settles

@sbryngelson
sbryngelson marked this pull request as draft August 27, 2026 14:19
@wilfonba

Copy link
Copy Markdown
Contributor Author

@sbryngelson what is remeaing that needs to settle?

@sbryngelson

Copy link
Copy Markdown
Member

12 PRs, many of which with fickle CI results of unknown origin, and questionable CI integrity at best. I'm glad to have you work on that!

@codecov

codecov Bot commented Aug 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 62.00000% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 61.66%. Comparing base (1def0a6) to head (e25ffda).

Files with missing lines Patch % Lines
src/simulation/m_time_steppers.fpp 50.00% 9 Missing ⚠️
src/simulation/m_start_up.fpp 55.55% 3 Missing and 1 partial ⚠️
src/common/m_mpi_common.fpp 0.00% 3 Missing ⚠️
src/simulation/m_collisions.fpp 71.42% 2 Missing ⚠️
src/simulation/m_sim_helpers.fpp 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1757      +/-   ##
==========================================
- Coverage   61.67%   61.66%   -0.02%     
==========================================
  Files          84       84              
  Lines       21619    21651      +32     
  Branches     3196     3200       +4     
==========================================
+ Hits        13334    13351      +17     
- Misses       6093     6107      +14     
- Partials     2192     2193       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants